/**
 * @author LIU YUAN
 * @date May 15, 2011 11:12:21 AM
 * @param <T>
 */
#include "StdAfx.h"
#include "NearJmp.h"

using namespace upupc;
NearJmp::NearJmp(void)
	:parameter(0)
{
}


NearJmp::~NearJmp(void)
{
}

void
NearJmp::setParameter(UINT mParameter)
{
	parameter = mParameter;
}

CHAR*
NearJmp::parse(DWORD eip)
{
	PCHAR content = new CHAR[bufferSize];
	memcpy_s(content,bufferSize,&cmd,1);

	DWORD offset = parameter - (eip + bufferSize);
	memcpy_s(content+1,bufferSize-1,(CHAR*)&offset,4);
	return content;
}

DWORD
NearJmp::size()
{
	return bufferSize;
}
